const Events = require("events");
class Gog extends Events {
  constructor(name, age) {
    super();
    this.name = name;
    this.age = age;
  }
  growUp() {
    this.age++;
    this.emit("change");
  }
}

const gog = new Gog("Gog", 18);
gog.addListener("change", () => {
  console.log("Age changed");
});
gog.growUp();
console.log(gog.age);
